package com.xsg.printer.core.model;

import com.xsg.printer.core.enums.BorderStyleEnum;
import com.xsg.printer.core.enums.ColorEnum;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;

@Data
@Accessors(chain = true)
public class XsgBorder implements Serializable {

    public static XsgBorder fullBorder() {
        return new XsgBorder().setBottomStyle(BorderStyleEnum.FULL).setLeftStyle(BorderStyleEnum.FULL).setTopStyle(BorderStyleEnum.FULL).setRightStyle(BorderStyleEnum.FULL).setColor(ColorEnum.BLACK);
    }

    public static XsgBorder hiddenBorder() {
        return new XsgBorder().setBottomStyle(BorderStyleEnum.NONE).setLeftStyle(BorderStyleEnum.NONE).setTopStyle(BorderStyleEnum.NONE).setRightStyle(BorderStyleEnum.NONE);
    }

    /**
     * 顶部线条类型 1:实线 2:虚线
     */
    private int topStyle;

    /**
     * 右部线条类型 1:实线 2:虚线
     */
    private int rightStyle;

    /**
     * 左部线条类型 1:实线 2:虚线
     */
    private int leftStyle;

    /**
     * 下部线条类型 1:实线 2:虚线
     */
    private int bottomStyle;

    /**
     * 颜色
     */
    private int color;

    public XsgBorder setTopStyle(BorderStyleEnum borderStyleEnum) {
        this.topStyle = borderStyleEnum.getType();
        return this;
    }

    public XsgBorder setRightStyle(BorderStyleEnum borderStyleEnum) {
        this.rightStyle = borderStyleEnum.getType();
        return this;
    }

    public XsgBorder setLeftStyle(BorderStyleEnum borderStyleEnum) {
        this.leftStyle = borderStyleEnum.getType();
        return this;
    }

    public XsgBorder setBottomStyle(BorderStyleEnum borderStyleEnum) {
        this.bottomStyle = borderStyleEnum.getType();
        return this;
    }

    public XsgBorder setColor(ColorEnum colorEnum) {
        this.color = colorEnum.getType();
        return this;
    }
}
